package tr.edu.yildiz.ce.dap.appagent.commands;

import tr.edu.yildiz.ce.dap.appagent.basic.BasicListenerMock;
import tr.edu.yildiz.ce.dap.appagent.model.Actions;
import tr.edu.yildiz.ce.dap.appagent.model.App;
import tr.edu.yildiz.ce.dap.appagent.model.AppList;
import tr.edu.yildiz.ce.dap.appagent.model.Component;
import tr.edu.yildiz.ce.dap.appagent.model.ComponentList;
import tr.edu.yildiz.ce.dap.appagent.model.DapMessage;
import tr.edu.yildiz.ce.dap.appagent.util.DeploymentConstants;

public class DetailListenerMock extends BasicListenerMock{

	@Override
	public DapMessage reply(DapMessage input) {
		DapMessage dapMessage = new DapMessage();
		dapMessage.setAppName("sampe_app");
		dapMessage.setAppVersion("2.3");
		dapMessage.setComponentList(new ComponentList());
		
		Component c1 = new Component();
		c1.setName("sample_app_dao");
		c1.setVersion("2.3.0");
		c1.setUrl("ftp://localhost/repo/sample_app_dao_2.3.0.jar");
		c1.setActions(new Actions());
		c1.getActions().getAction().add(DeploymentConstants.Action.INSTALL);
		
		dapMessage.getComponentList().getComponent().add(c1);
		
		Component c2 = new Component();
		c2.setName("sample_app_service");
		c2.setVersion("2.3.0");
		c2.setUrl("ftp://localhost/repo/sample_app_service_2.3.0.jar");
		c2.setActions(new Actions());
		c2.getActions().getAction().add(DeploymentConstants.Action.INSTALL);
		c2.getActions().getAction().add(DeploymentConstants.Action.START);
		
		dapMessage.getComponentList().getComponent().add(c2);
		
		return dapMessage;
	}

}
